Repository navigation
Quiet log findings resolve again: the log analyzer may use the log reader - #511
Merged
Merged
Conversation
…ader On an install in the same account as the logs it reads, the permissions boundary let only the gateway and worker take on CoderHelmLogReader. The log analyzer, its main user, was refused (AccessDenied in a permissions boundary) on every run, so no finding was refreshed or resolved, and the page kept promising a resolve date that had passed. - Boundary: the log analyzer's role (now tagged coderhelm:role=log-analyzer) may take on the read roles here; its own role policy keeps it to the log reader. One statement, so the boundary stays under IAM's size limit. IAM simulator fixtures regenerated for the boundary and runtime verdicts; the access check verifies the analyzer's real role can't take on the data-source role. - One quiet-period rule: the page's resolve date is worked out exactly as the sweep does (quiet_days_for in Rust and Python, checked against shared cases), instead of a stored value that was missing or stale. - A passed date is never a promise: the page says the next check resolves it, or that checks are failing and why, with a banner per account. - A query that fails holds only the log groups it covered; quiet findings in the other groups still resolve. - The analyzer reads nanosecond times on every Python version. - The native simulator script resolves a parameter that points at a parent role.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a self-host install in the same AWS account as the logs it reads, the permissions boundary refused the log analyzer
sts:AssumeRoleonCoderHelmLogReader(explicit deny in the boundary). Every analyzer run failed, so no finding was refreshed or resolved, while the page kept promising a resolve date that had already passed. This lets the analyzer read logs again, makes the page's date the sweep's date, and says plainly when checks are failing.Changes
infra/lib/access.ts): the read-role exception now admits the log analyzer's tag (coderhelm:role=log-analyzer, set inlog-analyzer-stack.ts) alongside the gateway and worker, in the same single statement so the boundary stays under IAM's 6,144 characters. The analyzer's own role policy allowssts:AssumeRoleonCoderHelmLogReaderonly, so it still can't take on the data-source role.selfhost/check-access.mjs): the analyzer's role must carry the tag, and the policy simulator, run on its real role, must deny itCoderhelmReadOnly.deploy-role-sim.py(and--native, whose script now resolves a parameter that points at a parent role). The CloudFormation call rows are unchanged. AWS's registry has since addeddynamodb:DescribeBulkOperationand other handler actions, which the simulator doesn't know yet; that drift is left for its own change.common::log_findings::quiet_days_for): the page works the resolve date out from the same inputs as the analyzer'slifecycle.quiet_days_for(daily lines, last resolve, reopen), not a storedquiet_daysthat was missing or stale (it showed 3 days where the sweep uses 8). Both are checked againstservices/common/tests/fixtures/quiet_days_cases.json.resolve_stategivesscheduled,due(the next check resolves it) orblocked(checks have failed since X, with the cause in plain words).GET /api/log-findingsaddsresolveto each finding andanalysis_failingper account.parse_tsreads nanosecond times on Python 3.12.Verification
npm test, 145 of 145 pass (boundary size, own-account roles, simulator fixtures).node --test launch/check-access.test.mjs, 12 of 12, including a new case where an analyzer role that may take on the data-source role fails.python3 -m unittest discover -s lambda/tests, 381 pass. New tests: the shared cases, the incident (an acknowledged finding that came back resolves 8 days after its last line, not 3), and a failing query holding only its groups.cargo fmt,cargo clippy -p common -p gateway --all-targets -D warningsclean;cargo test -p common log_findings28 pass and-p gateway log_findings6 pass. New tests cover the shared cases, a stale stored value, and scheduled, due and blocked states.AccessDenied ... explicit deny in a permissions boundaryevery 6 hours since its last good run; 18 open findings, none resolved since.